<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        //之前的两种方式
        var obj = new Object();
        obj.name="zhangsan";
        obj.age=18;

        console.log(obj)

        var obj1 = {
            name:"lisi",
            age:19
        }
        console.log(obj1)

        //通过工厂方式创建对象
        function createdPerson(name,age){
            var obj  =  new Object();
            obj.name = name;
            obj.age = age;

            return obj;
        }

        var o1 = createdPerson("zhangsan",20);
        var o2 = createdPerson("Lisi",30);

        console.log(o1)
        console.log(o2)

    </script>
</head>
<body>

</body>
</html>
